package com.nuoniu.sibanyun.controller.erp.barcode;


import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.nuoniu.sibanyun.common.result.HttpResult;
import com.nuoniu.sibanyun.entity.dto.BarcodeMainInfoDto;
import com.nuoniu.sibanyun.entity.dto.BarcodeMainInfoSearchDto;
import com.nuoniu.sibanyun.entity.dto.ErpBarcodePrintSearchDto;
import com.nuoniu.sibanyun.service.erp.barcode.IErpBarcodeMainInfoService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import com.nuoniu.sibanyun.common.result.HttpResult;
import com.nuoniu.sibanyun.config.YmlConfig;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.tools.ant.taskdefs.Input;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;

import com.nuoniu.sibanyun.common.BaseController;

/**
 * <p>
 * 条码管理-条码主档 前端控制器
 * </p>
 *
 * @author 白强
 * @since 2021-11-10
 */
@RestController
@RequestMapping("/erp/barcode/mainInfo")
@Api(tags = "条码主档管理")
public class ErpBarcodeMainInfoController extends BaseController {

    @Autowired
    private IErpBarcodeMainInfoService barcodeMainInfoService;

    @GetMapping("analysisByBarCode")
    @ApiOperation("条码解析")
    public HttpResult save(BarcodeMainInfoSearchDto barcodeMainInfoSearchDto){
        return HttpResult.ok(barcodeMainInfoService.analysisByBarCode(barcodeMainInfoSearchDto));
    }

    @ApiOperation("获取条码安装文件")
    @GetMapping("getBarCodeFileUrl")
    public HttpResult getBarCodeFileUrl() {
        return HttpResult.ok(YmlConfig.DOWNLOAD_FILE_URL + "office/" + "CLodop_Setup_for_Win32NT.exe");
    }

    @PostMapping("listByDetailIdsAndSourceVoucherType")
    @ApiOperation("通过 来源明细ID 和 来源类型 获取条码主档信息")
    public HttpResult listByDetailIdsAndSourceVoucherType(@RequestBody BarcodeMainInfoDto barcodeMainInfoDto){
        return HttpResult.ok(barcodeMainInfoService.listByDetailIdsAndSourceVoucherType(barcodeMainInfoDto));
    }

}
